package com.seveneight.baijiesteward.ui.first.presenter;

import android.content.Context;

import com.seveneight.baijiesteward.bean.OrderBean;
import com.seveneight.baijiesteward.http.MyCallBack;
import com.seveneight.baijiesteward.ui.first.contract.CreatCashOrderContract;
import com.seveneight.baijiesteward.ui.first.model.CreatCashOderModel;

import okhttp3.RequestBody;

/**
 * Created by user1 on 2018/3/29.
 */

public class CreatCashOrderPresenter implements CreatCashOrderContract.CreateCashOderPresenter {

    CreatCashOrderContract.CreateCashOderView createCashOderView;
    CreatCashOrderContract.CreateCashOderModel createCashOderModel;

    public CreatCashOrderPresenter(CreatCashOrderContract.CreateCashOderView createCashOderView) {
        this.createCashOderView = createCashOderView;
        createCashOderModel = new CreatCashOderModel();
    }

    @Override
    public void createOrder(Context context, RequestBody body) {
        createCashOderModel.createOrder(context,body, new MyCallBack<OrderBean>() {
                    @Override
                    public void onSuccess(OrderBean orderBean) {
                        createCashOderView.reBackOrderInfo(orderBean);
                    }

                    @Override
                    public void onFailed() {

                    }
                });
    }
}
